package org.come.Jpanel;

import javax.swing.*;
import java.awt.*;

public class CustomTitleBarUI2 extends JPanel {
    private String title;


    public CustomTitleBarUI2(JFrame frame) {

        setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
        setPreferredSize(new Dimension(frame.getWidth(), 5));

    }


    @Override
    protected void paintComponent(Graphics g) {

        Graphics2D g2d = (Graphics2D) g;
//        Color color = new Color(113, 154, 194);
        Color color1 = new Color(113, 154, 194);
//        GradientPaint gradient = new GradientPaint(0, 0, color, 0, getHeight() - 1, color1);
//        g2d.setPaint(gradient);
        g.setColor(color1);
        g2d.fillRect(0, 0, getWidth(), getHeight());
    }


    public static void main(String[] args) {
        JFrame frame = new JFrame("Custom Title Bar UI Demo");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(400, 300);
//        frame.setUndecorated(true);
        CustomTitleBarUI2 customTitleBarUI = new CustomTitleBarUI2(frame);
        customTitleBarUI.setOpaque(false);
        frame.add(customTitleBarUI, BorderLayout.NORTH);

        frame.setVisible(true);
    }


}

